{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "world!\n",
      "worldworldworld\n",
      "Hello china!Hello,Python.Hello boy and gird!\n",
      "3\n",
      "hello world!hello,python.hello boy and gird!\n",
      "HELLO WORLD!HELLO,PYTHON.HELLO BOY AND GIRD!\n",
      "Hello World!Hello,Python.Hello Boy And Gird!\n",
      "Hello world!hello,python.hello boy and gird!\n",
      "['zhangsan', '李四', '曹操', '刘备']\n"
     ]
    }
   ],
   "source": [
    "str1=\"Hello world!Hello,Python.Hello boy and gird!\"\n",
    "\n",
    "# 打印输出 world!\n",
    "print(str1[6:12]) \n",
    "\n",
    "# 打印worldworldworld\n",
    "str2 = \"world\"\n",
    "print(str2*3) \n",
    "\n",
    "# 将str1中world替换china\n",
    "print(str1.replace(\"world\",\"china\")) \n",
    "\n",
    "# 打印str1中Hello的数量\n",
    "print(str1.count(\"Hello\")) \n",
    "\n",
    "# 打印str1，全部小写\n",
    "print(str1.lower()) \n",
    "\n",
    "# 打印str1，全部大写\n",
    "print(str1.upper()) \n",
    "\n",
    "# 打印str1，单词首字母大写\n",
    "print(str1.title()) \n",
    "print(str1.capitalize()) \n",
    "\n",
    "str3 = \"zhangsan+李四+曹操+刘备\"\n",
    "# 将str3分割为人名的列表\n",
    "print(str3.split(\"+\")) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
